<?php
namespace Home\Model;
use Think\Model;

class MemberModel extends Model {

    protected $_validate = array (
		array('username','require','The email address is already exist.', 1 , unique , Model::MODEL_INSERT),
		array('password','require','password required', 1 , 0 , Model::MODEL_INSERT),
		array('phone','require','phone required', 1 , 0 , Model::MODEL_INSERT),
    );	

    protected $_auto = array (
		array('regDate','time',Model::MODEL_INSERT,'function'),		
		array('regIP','_ip',Model::MODEL_BOTH,'callback'),
		array('loginDate','time',Model::MODEL_INSERT,'function'),		
		array('loginIP','_ip',Model::MODEL_BOTH,'callback'),
		array('password','md5',Model::MODEL_INSERT,'function'),
		array('status','_status',Model::MODEL_BOTH,'callback'),		
		array('verify','_verify',Model::MODEL_BOTH,'callback'),		
	);

	protected function _ip(){
		return get_client_ip();
	}

	protected function _status(){
		if (C('EMAIL_VERIFY')=='1') {
			return 0;
		}else{
			return 0;
		}	
	}

	protected function _verify(){
		return MD5('alex'.I('post.username')); 
	}
}
?>